# -*- coding: utf-8 -*-
# @Time    : 2024/8/29 10:45
# @Author  : Alvin
# @File    : my_http.py
import requests

from app.libs.error_code import RequestFailed


class Http:
    @staticmethod
    def post(url, data=None):
        try:
            response = requests.post(url, data)
            return response.json()
        except Exception as e:
            raise RequestFailed(msg="内部post请求错误")

    @staticmethod
    def get(url, params=None):
        try:
            response = requests.get(url, params=params)
            return response.json()
        except Exception as e:
            raise RequestFailed(msg="内部get请求错误")
